package ch10oopexer1;

import ch4oopexer1.Encryption;

import java.util.InputMismatchException;
import java.util.Scanner;

public class CourseTimeTest {
    public static void main(String[] args) throws Exception{
        Scanner scan = new Scanner(System.in);
        CourseTime courseTime=new CourseTime();
        try {
            System.out.print("请输入总课时：");
            courseTime.setTotalTime(scan.nextInt());
            if(courseTime.getTotalTime()<100){
                throw new Exception("课程时长太少！");
            }
            System.out.print("请输入总课程：");
            courseTime.setTotalCourse(scan.nextInt());
    }catch (InputMismatchException e){
           System.err.println("输入错误");
            e.printStackTrace();
        }
        int c=courseTime.chufa(courseTime.getTotalTime(),courseTime.getTotalCourse());
        System.out.println("平均课程时间："+c);

    }
       /* double totalTime;
        double totalCourse;

        try {

            System.out.print("请输入总课时：");
             totalTime = scan.nextDouble();

            try {
                if(totalTime<100){}
            }catch (Exception e){
                System.out.println("课程时长太少！");
                throw e;
            }
            System.out.print("请输入总课程：");
             totalCourse=scan.nextDouble();
        }catch (InputMismatchException e){
            System.err.println("输入错误");
            e.printStackTrace();
        }
        double c=courseTime.chufa(totalTime,totalCourse);
        System.out.println("平均课程时间："+c);

    }*/
}
